﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Codeology.Auctioneer
{

    internal static class DateUtils
    {

        private static DateTime unix_epoch = new DateTime(1970,1,1,0,0,0,0);

        #region Static Methods

        public static long DateTimeToUnix(DateTime value)
        {
            return (value.Ticks - unix_epoch.Ticks) / 10000000;
        }

        public static DateTime UnixToDateTime(long value)
        {
            return new DateTime((value * 10000000) + unix_epoch.Ticks);
        }

        #endregion

        #region Static Properties

        public static DateTime UnixEpoch
        {
            get {
                return unix_epoch;
            }
        }

        #endregion

    }

}
